using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SmallBullet : MonoBehaviour
{
    Rigidbody2D rigidbody2d;
    void Awake()
    {
        rigidbody2d = GetComponent<Rigidbody2D>();
    }
    // Start is called before the first frame update
    void Start()
    {
        if (transform.position.magnitude > 100)
        {
            Destroy(gameObject);
        }
    }

    public void Launch(Vector2 dir, float force)
    {
        rigidbody2d.AddForce(dir * force);
    }

    // Update is called once per frame
    void Update()
    {
        if (transform.position.x < -11.2f)
        {
            Destroy(gameObject);
        }
        if (!Global.instance.StartFlag)
        {
            Destroy(gameObject);
        }
    }
}
